<script>
function showMenu( divNum )
{ 
	$(".s"+divNum).slideToggle();
	$("#i"+divNum).toggle();
}
</script>
<div class="sidebar_box">
				<h3>Categories</h3>   
                <div class="menu"> 
					<b>Spare Parts & Accessories</b><br />
                	<?php
					$query = mysql_query("SELECT * FROM tblbrand")or die(mysql_error());
					
					$display = '';
					while($row = mysql_fetch_array($query)){
							$brandid = $row['id'];
							$brandname = $row['brand'];
								$display .= '<div class="mhead"><img style="position: absolute; margin-top: 4px;" src="images/minus.png"
								 border="0" width="11" height="12" /> <img id="i'.$brandid.'" name="i'.$brandid.'" style="position: absolute; margin-top: 4px;" src="images/plus.png"
								border="0" width="11" height="12" /> &nbsp; &nbsp;<a href="javascript:showMenu('.$brandid.');"><font style="font-size: 12px;">' .$brandname.'</font></a></div>';
								
							$query2 = mysql_query("SELECT * FROM tblmodel")or die(mysql_error());			
							while($rows = mysql_fetch_array($query2)){
								
								if($brandid == $rows['brandId']){
							
								$display .= '<div id="submenu" class="s'.$brandid.'" style="display: none;"> <img style="position: absolute; margin-top: 3px;" src="images/img_tree_empty.png" /> &nbsp; &nbsp; <a href="shop.php?model='.$rows['modelname'].'" name="'.$rows['modelname'].'">'.$rows['modelname'].'</a><br /></div>';	
							
								}
								
						}
						
					}
					echo $display;
				?>
				</div>
			</div>